//
//  MyWalletBackView.m
//  GLGW_Shoping
//
//  Created by whx on 2018/12/5.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "MyWalletBackView.h"
#import "MyWalletView.h"
#import "MyWalletMiddleView.h"
#import "MyWalletBottomView.h"

@implementation MyWalletBackView

- (id)initWithFrame:(CGRect)aFrame inSuperView:(UIView *)aSuperView
{
    if (self = [super initWithFrame:aFrame inSuperView:aSuperView]) {
        self.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
        
        kWeakSelf(self);
        MyWalletView *topView = [[MyWalletView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, kHeightProportion_In_iPhoneTriploid(204)) inSuperView:self];
        topView.BlockLeftBtn = ^(GLGWButton * _Nullable leftbtn) {
            [weakself leftAction:leftbtn];
        };
        GLGWView *liView = [[GLGWView alloc] initWithFrame:CGRectMake(0, kY_With_View(topView, 0), KScreenWidth, kHeightProportion_In_iPhoneTriploid(10)) inSuperView:self];
        liView.backgroundColor = self.backgroundColor;
        
        MyWalletMiddleView *middleView = [[MyWalletMiddleView alloc] initWithFrame:CGRectMake(0, kY_With_View(liView, 0), KScreenWidth, kHeightProportion_In_iPhoneTriploid(80)) inSuperView:self];
        
        GLGWView *liView2 = [[GLGWView alloc] initWithFrame:CGRectMake(0, kY_With_View(middleView, 0), KScreenWidth, kHeightProportion_In_iPhoneTriploid(10)) inSuperView:self];
        liView2.backgroundColor = self.backgroundColor;
        
        MyWalletBottomView *bottomView = [[MyWalletBottomView alloc] initWithFrame:CGRectMake(0, kY_With_View(liView2, 0), KScreenWidth, kHeightProportion_In_iPhoneTriploid(155)) inSuperView:self];
        bottomView.BlockBtn = ^(GLGWButton * _Nullable btn) {
            [weakself btnAction:btn];
        };
        
    }
    return self;
}

- (void)leftAction:(GLGWButton *)sender
{
    if (self.BlockLeftBtn) {
        self.BlockLeftBtn(sender);
    }
}

- (void)btnAction:(GLGWButton *)sender
{
    if (self.BlockBtn) {
        self.BlockBtn(sender);
    }
}

@end
